﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Routing;
using System.Web.Security;
using System.Web.SessionState;

namespace Web_Oto
{
    public class Global : System.Web.HttpApplication
    {
        public static void RegisterRoutes(RouteCollection routes)
        {
            RouteTable.Routes.Ignore("{resource}.axd/{*pathInfo}");
            routes.MapPageRoute("Contact", "lien-he.html", "~/Contact.aspx");
            routes.MapPageRoute("AboutUs", "gioi-thieu.html", "~/AboutUs.aspx");
            routes.MapPageRoute("Default", "trang-chu.html", "~/Default.aspx");
            routes.MapPageRoute("Service_nopaging", "dich-vu-tu-van.html", "~/Services.aspx");
            routes.MapPageRoute("Service", "dich-vu-tu-van/{currentPage}.html", "~/Services.aspx");
            routes.MapPageRoute("ServiceDetail", "dich-vu-tu-van/{service_name}/{serviceId}.html", "~/ServiceDetail.aspx");
            routes.MapPageRoute("payment", "phuong-thuc-thanh-toan.html", "~/Payment.aspx");
            routes.MapPageRoute("News_nopaging", "tin-tuc.html", "~/news.aspx");
            routes.MapPageRoute("News", "tin-tuc/{currentPage}.html", "~/news.aspx");
            routes.MapPageRoute("NewDetail", "tin-tuc/{news_title}/{newsId}.html", "~/NewsDetail.aspx");
            routes.MapPageRoute("Products_nopaging", "san-pham.html", "~/Products.aspx");
            routes.MapPageRoute("Products", "san-pham/{currentpage}.html", "~/Products.aspx");
            routes.MapPageRoute("ProductDetail", "san-pham/{category}/{sub_category}/{productName}-{productId}.html", "~/ProductDetail.aspx");
            routes.MapPageRoute("ProductsList", "san-pham/{category}/{sub_category}/{currentpage}.html", "~/Products.aspx");
            routes.MapPageRoute("Search", "tim-kiem.html", "~/Search.aspx");
            routes.MapPageRoute("Search_haskey", "tim-kiem/{keyword}.html", "~/Search.aspx");
            routes.MapPageRoute("Search_paging", "tim-kiem/{keyword}/{currentPage}.html", "~/Search.aspx");
            
        }
        void Application_Start(object sender, EventArgs e)
        {
            // Code that runs on application startup
            RegisterRoutes(RouteTable.Routes);
        }

        void Application_End(object sender, EventArgs e)
        {
            //  Code that runs on application shutdown

        }

        void Application_Error(object sender, EventArgs e)
        {
            // Code that runs when an unhandled error occurs

        }

        void Session_Start(object sender, EventArgs e)
        {
            // Code that runs when a new session is started

        }

        void Session_End(object sender, EventArgs e)
        {
            // Code that runs when a session ends. 
            // Note: The Session_End event is raised only when the sessionstate mode
            // is set to InProc in the Web.config file. If session mode is set to StateServer 
            // or SQLServer, the event is not raised.

        }

    }
}
